package com.esri.core.renderer;

import com.esri.core.internal.util.d;
import java.io.IOException;
import java.io.StringWriter;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonNode;

/* loaded from: classes.dex */
public abstract class ColorRamp {
    private static final String a = "type";
    private String b;

    public ColorRamp(JsonNode jsonNode) {
        this.b = d.a(jsonNode, a);
    }

    public ColorRamp(String str) {
        this.b = str;
    }

    public String toJson() throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a2 = d.a(stringWriter);
        a2.writeStartObject();
        toJson(a2);
        a2.writeEndObject();
        a2.close();
        return stringWriter.toString();
    }

    public void toJson(JsonGenerator jsonGenerator) throws IOException, JsonGenerationException, Exception {
        jsonGenerator.writeStringField(a, this.b);
    }

    public String toString() {
        return "ColorRamp [type=" + this.b + "]";
    }
}
